import { FormFieldModel, FormModel, FormTypeEnum } from 'pf-component';

export const buildApprovalForm = (): FormModel => {
  return new FormModel({
    name: 'ApprovalForm',
    fields: [
      new FormFieldModel({
        prop: 'comment',
        label: '审批意见',
        spanCol: 2
      }),
      new FormFieldModel({
        prop: 'opType',
        label: '操作类型',
        type: FormTypeEnum.SELECT.code,
        options: [
          { key: 'commit', value: '通过' },
          { key: 'reject', value: '驳回' } /*,
          { key: "trans", value: "转派" }*/
        ]
      }),
      new FormFieldModel({
        prop: 'taskDefinitionKey',
        label: '驳回到',
        type: FormTypeEnum.SELECT.code,
        hidden: true,
        required: false,
        options: []
      }),
      new FormFieldModel({
        prop: 'userId',
        label: '转派给',
        type: FormTypeEnum.SELECT.code,
        hidden: true,
        required: false,
        options: [
          {
            key: '10087',
            value: '10087'
          }
        ]
      })
    ]
  });
};

export const buildApprovalHistoryForm = (): FormModel => {
  return new FormModel({
    name: 'ApprovalHistoryForm',
    disabled: true,
    fields: [
      new FormFieldModel({
        prop: 'taskName',
        label: '任务名称'
      }),
      new FormFieldModel({
        prop: 'taskDefinitionKey',
        label: '任务ID'
      }),
      new FormFieldModel({
        prop: 'taskInsId',
        label: '任务实例ID'
      }),
      new FormFieldModel({
        prop: 'startTime',
        label: '开始时间'
      }),
      new FormFieldModel({
        prop: 'endTime',
        label: '结束时间'
      }),
      new FormFieldModel({
        prop: 'assignee',
        label: '审批人'
      }),
      new FormFieldModel({
        prop: 'comment',
        label: '审批意见'
      })
    ]
  });
};
